<template>
  <section>
    <!--工具条-->
    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-date-picker
              v-model="filters.startTime"
              type="date"
              placeholder="开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-date-picker
              v-model="filters.endTime"
              type="date"
              placeholder="截止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="getUser">查询</el-button>
        </el-form-item>
      </el-form>
    </el-col>

    <!--列表-->
    <template>
      <el-table :data="users" highlight-current-row v-loading="loading" style="width: 100%;">
        <el-table-column type="index" width="60">
        </el-table-column>
        <el-table-column prop="birth" label="日期" width="120" align="center">
        </el-table-column>
        <el-table-column prop="url" label="产品LOGO" width="140" align="center">
          <template slot-scope="scope">
            <el-image
                style="width: 50px; height: 50px"
                :src="scope.row.url"
                fit="fill"></el-image>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="产品名称" width="120" align="center">
        </el-table-column>
        <el-table-column prop="sex" label="新客还款" width="100" align="center">
        </el-table-column>
        <el-table-column prop="birth" label="新客应还" width="100" align="center">
        </el-table-column>
        <el-table-column prop="addr" label="新客逾期率" width="140" align="center">
        </el-table-column>
        <el-table-column prop="sex" label="老客还款" width="100" align="center">
        </el-table-column>
        <el-table-column prop="birth" label="老客应还" width="100" align="center">
        </el-table-column>
        <el-table-column prop="addr" label="老客逾期率" width="140" align="center">
        </el-table-column>
        <el-table-column prop="sex" label="还款总量" width="100" align="center">
        </el-table-column>
        <el-table-column prop="sex" label="应还总量" width="100" align="center">
        </el-table-column>
        <el-table-column prop="addr" label="逾期率" min-width="140" align="center">
        </el-table-column>
      </el-table>
      <el-col :span="24" class="toolbar">
        <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="20" :total="total" style="float:right;">
        </el-pagination>
      </el-col>
    </template>

  </section>
</template>
<script>
import {getUserList, getUserListPage} from '../../api/api';
//import NProgress from 'nprogress'
export default {
  data() {
    return {
      filters: {
        startTime: '',
        endTime:''
      },
      loading: false,
      users: [
      ],
      page: 1,
      total: 0,
    }
  },
  methods: {
    //获取用户列表
    getUser: function () {
      let para = {
        startTime: this.filters.startTime,
        endTime: this.filters.endTime,
        page: this.page,
      };
      this.loading = true;
      //NProgress.start();
      getUserListPage(para).then((res) => {
        this.users = res.data.users;
        this.total = res.data.total;
        this.loading = false;
        //NProgress.done();
      });
    }
  },
  mounted() {
    this.getUser();
  }
};

</script>

<style scoped>

</style>